<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<?php $this->load->view('admin/header.html');?>
<script type="text/javascript" src="<?php echo base_url()?>common/js/validateForm.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/js/MyJs.js"></script>

<div id="dcMain">
    <!-- 当前位置 -->
    <div id="urHere">DouPHP 管理中心</div>  <div id="index" class="mainBox" style="padding-top:18px;height:auto!important;height:550px;min-height:550px;">
        <!--<div class="warning"></div>-->

        <div id="douApi"></div>

        <div class="indexBox">
            <div class="boxTitle">服务器信息</div>
           
                <table width="100%" border="0" cellspacing="0" cellpadding="7" class="tableBasic">
                    <tbody>
                        <tr>
                            <td width="120" valign="top">PHP 版本：</td>
                            <td valign="top"><?php echo phpversion();?> </td>
                            <td width="100" valign="top">MySQL 版本：</td>
                            <td valign="top"><?php echo $this->db->conn_id->server_info?></td>
                            <td width="100" valign="top">服务器操作系统：</td>
                            <td valign="top"><?php echo  php_uname('s')?></td>
                        </tr>
                        <tr>
                            <td valign="top">文件上传限制：</td>
                            <td valign="top"><?php $tem=ini_get_all();  echo $tem['upload_max_filesize']['local_value']?></td>
                            <td valign="top">GD 库支持：</td>
                            <td valign="top">是</td>
                            <td valign="top">Web 服务器：</td>
                            <td valign="top"><?php echo php_uname()?></td>
                        </tr>
                    </tbody>
                </table>
            
        </div>
        <script>
            function Success(data) {
                $.Success(data);
            }
            $(function () {
                $.validate_config('ajax_form');
            });
          
            KindEditor.ready(function (K) {
                var editor = K.editor({
                    uploadJson: '/common/kindeditor/php/upload_json.php',
                    allowFileManager: true
                });
                function initimg() {
                    editor.loadPlugin('image', function () {
                        editor.plugin.imageDialog({
                            imageUrl: K('#url1').val(),
                            clickFn: function (url, title, width, height, border, align) {
                                K('#sitelogo').val(url);
                                K('#img_tag').attr('src', url);
                                editor.hideDialog();
                            }
                        });
                    });
                }
                K('#img_tag').click(function () {
                    initimg();
                });
                K('#sitelogo').dblclick(function () {
                    initimg();
                });
            });
            function Del(cid) {
                layer.confirm("确定删除", function () {
                    $.post("/admin/sys/delconfig/" + cid, null, function (data) {
                        var jsonData = $.parseJSON(data);
                        if (jsonData.Statu == 'ok') {
                            Success(jsonData)
                        }
                        else {
                            Success(jsonData)
                        }
                    })
                }, function () {
                    layer.msg('取消删除', { icon: 0 });
                })
            }
        </script>
        <div class="indexBox">
            <div class="boxTitle">网站设置</div>
            <form id="ajax_form" action="<?php echo site_url('admin/sys/edit_config')?>" method="post">
                <input id="cid" name="cid" type="hidden" value="<?php echo !empty($configModel)?$configModel->cid:0?>" />
                <input id="mark" name="mark" type="hidden" value="<?php echo !empty($configModel)?1:0?>" />
                <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                    <tr>
                        <td width="100" align="right">网站Logo</td>
                        <td style="position:relative;">
                            <img id="img_tag" src="<?php echo !empty($configModel)?$configModel->sitelogo:""?>" onerror="this.src='<?php echo base_url('common')?>/images/nopic.png'" style="height:100px;width:100px;cursor:pointer;float:left;" />
                            <div style="float: left;position: absolute;bottom: 9px;left: 113px;">
                                <input type="text" id="sitelogo" name="sitelogo" size="40" class="inpMain" value="<?php echo !empty($configModel)?$configModel->sitelogo:""?>" readonly="readonly" />
                                <a href="javascript:$.DeleteImg('img_tag','sitelogo')" style="margin-left:20px;">删除</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td width="100" align="right">网站标题</td>
                        <td>
                            <input type="text" id="title" name="title" size="40" class="inpMain" value="<?php echo !empty($configModel)?$configModel->title:""?>" />
                        </td>
                    </tr>
                    <tr>
                        <td width="100" align="right">网站关键字</td>
                        <td>
                            <textarea class="inpMain" id="keyword" name="keyword" style="resize:none;height:100px;width:600px;"><?php echo !empty($configModel)?$configModel->keyword:""?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">网站描述</td>
                        <td>
                            <textarea class="inpMain" id="description" name="description" style="resize:none;height:100px;width:600px;"><?php echo !empty($configModel)?$configModel->description:""?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">网站版权</td>
                        <td>
                            <input type="text" id="copyright" name="copyright" size="70" class="inpMain" value="<?php echo !empty($configModel)?$configModel->copyright:""?>" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">备案号</td>
                        <td>
                            <input type="text" id="icp" name="icp" size="70" class="inpMain" value="<?php echo !empty($configModel)?$configModel->icp:""?>" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">统计代码</td>
                        <td>
                            <textarea class="inpMain" id="statistics" name="statistics" style="resize:none;height:100px;width:600px;"><?php echo !empty($configModel)?$configModel->statistics:""?></textarea>
                         
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <input type="submit" class="btn" value="<?php echo !empty($configModel)?"修改":"添加"?>" />
                            <?php if(!empty($configModel)){?>
                            <input type="button" class="btn" onclick="Del(<?php echo $configModel->cid?>)" value="删除" />
                            <?php }?>
                            <input type="button" class="btn" value="返回" onclick="GoBack()" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>